import { DELETE, GET, POST, PUT } from './index'

// 本地调试登录
export function betaLogin (params) {
  return POST('/nutrition/open/login/memberPhone', params)
}

// 微信静默登录
export function WxUserLogin (params) {
  return POST('/nutrition/open/login/memberWechat', params)
}
// js-sdk
export function jsSdk (params) {
  return GET('/nutrition/open/login/jsSdk/', params)
}

/* 首页  */

// 查询商城热销商品
export function getMallProductList (params) {
  return GET('/nutrition/portal/product/mallProductList', params)
}

/* 就诊人 */
// 获取就诊人列表
export function getPatientsList (params) {
  return GET('/nutrition/portal/onlinePatient/list', params)
}
// 获取就诊人信息
export function getPatient (params) {
  return GET('/nutrition/portal/onlinePatient', params)
}
// 新增就诊人
export function addPatient (params) {
  return POST('/nutrition/portal/onlinePatient', params)
}
// 修改就诊人
export function editPatient (params) {
  return PUT(`/nutrition/portal/onlinePatient?id=${params.id}`, params)
}
// 删除就诊人
export function delPatient (params) {
  return DELETE('/nutrition/portal/onlinePatient', params)
}

// 城市列表
export function getCity (params) {
  return GET('/nutrition/portal/medicalInstitution/city', params)
}
// 获取医院列表
export function getInstitutionList (params) {
  return POST('/nutrition/portal/medicalInstitution/pageList', params)
}

// 医生姓名列表
export function getdoctorNameList (params) {
  return GET('/nutrition/portal/nutDoctor/doctorNameList', params)
}
// 项目列表

export function getProjectList (params) {
  return GET('/nutrition/portal/nutProject/select_pagination', params)
}
// 医生信息列表

export function getDoctorList (params) {
  return POST('/nutrition/portal/nutDoctor/select_pagination', params)
}

// 营养师列表
export function getNutritionistList (params) {
  return POST('/nutrition/open/nutritionist/pageList', params)
}

// 医生详情
export function getDoctorDetail (params) {
  return GET('/nutrition/portal/nutDoctor/doctorDetail', params)
}
// 营养师详情
export function getNutritionistDetail (params) {
  return GET('/nutrition/open/nutritionist/nutritionistDetail', params)
}
// 上门订单页面订单价格获取（交通费、服务费、总费用） GET
export function getOmputeOrderFee (params) {
  return GET('/nutrition/portal/nutOrder/computeOrderFee', params)
}

// 查看评价
export function getEvaluate (params) {
  return GET('/nutrition/portal/nutDoctorEvaluate/selectDoctorEvaluate', params)
}
// 搜索
export function getSearch (params) {
  return GET('/nutrition/portal/search/select_pagination', params)
}
// 历史搜索
export function getHistorySearch (params) {
  return GET('/nutrition/portal/search/selectSearchLog', params)
}
// 热门搜索
export function getPopularSearch (params) {
  return GET('/nutrition/portal/search/selectHotSearch', params)
}

// 清空历史搜索
export function delHistorySearch (params) {
  return GET('/nutrition/portal/search/deleteSearchLog', params)
}

// 上传图片
export function upload (params) {
  return POST('/nutrition/open/file/ossUpload', params)
}
// 创建线上订单
export function createOrder (params) {
  return POST('/nutrition/portal/nutOnlineOrder', params)
}
// 创建线下上门订单
export function createNutOrder (params) {
  return POST('/nutrition/portal/nutOrder/createOrder', params)
}
// 查询订单所需支付信息
export function getPayMessage (params) {
  return GET('/nutrition/portal/nutOnlineOrder/payMessage', params)
}
// 生成支付订单
export function payOrder (params) {
  return GET('/nutrition/portal/pay/unified', params)
}
// 退款
export function applyRefund (params) {
  return GET('/nutrition/portal/nutOnlineOrder/applyRefund', params)
}
// 删除订单
export function delOrder (params) {
  return GET('/nutrition/portal/nutOnlineOrder/deleteOrder', params)
}
// 取消订单
export function cancelOrder (params) {
  return GET('/nutrition/portal/nutOnlineOrder/cancelNutOnlineOrder', params)
}
// 线上订单详情
export function orderDetail (params) {
  return GET('/nutrition/portal/nutOnlineOrder/orderDetail', params)
}
// 线下订单详情
export function offlineOrderDetail (params) {
  return GET('/nutrition/portal/nutOrder/orderDetail', params)
}
// 添加医生/营养师评价 POST
export function addEvaluate (params) {
  POST('/nutrition/portal/nutDoctorEvaluate/addDoctorEvaluate', params)
}

/**
 * 营养自测
 */
// 查询自测表模板
export function getNutProjectField (params) {
  return GET(
    '/nutrition/portal/nutProjectField/selectProjectSelfTestFiled',
    params
  )
}
// 新增自测记录
export function addNutSelfTestRecord (params) {
  return POST(
    '/nutrition/portal/nutSelfTestRecord/addNutSelfTestRecord',
    params
  )
}
// 查询自测记录
export function getNutSelfTestRecord (params) {
  return GET(
    '/nutrition/portal/nutSelfTestRecord/selectNutSelfTestRecord',
    params
  )
}
/**
 * 营养科普
 */
// 查询营养科普文章列表（分页）
export function getScience (params) {
  return POST('/nutrition/portal/course/pageList', params)
}
// 科普文章/互助圈动态/评论   -点赞/取消点赞接口 POST
export function isPraise (params) {
  return POST('/nutrition/portal/nutPraiseLog/addOrCancelNutPraiseLog', params)
}
// 科普文章详情接口
export function getCourseDetail (params) {
  return GET('/nutrition/portal/course/courseDetail', params)
}
// 添加科普文章浏览记录
export function addNutBrowseLog (params) {
  return POST('/nutrition/portal/nutBrowseLog/addNutBrowseLog', params)
}
// 查询科普文章/互助圈动态的顶级评论信息（分页）
export function getPageListByPid (params) {
  return POST('/nutrition/portal/nutComment/pageListByPid', params)
}

/* 互助圈 */
// 查询互助圈动态列表（分页）
export function getNutHelpArticle (params) {
  return POST('/nutrition/portal/nutHelpArticle/pageList', params)
}
// 查询已关注但未浏览对应动态的作者信息（可指定查询数量）
export function getNotBrowseArticleAuthor (params) {
  return GET(
    '/nutrition/portal/nutHelpArticle/selectNotBrowseArticleAuthor',
    params
  )
}
// 发布互助圈动态
export function addNutHelpArticle (params) {
  return POST('/nutrition/portal/nutHelpArticle/addNutHelpArticle', params)
}

// 关注/取消关注接口 GET
export function isNutFocus (params) {
  return GET('/nutrition/portal/nutFocus/addOrCancelNutFocus', params)
}
// 查询未读消息数量
export function getMessageCount (params) {
  return GET('/nutrition/portal/nutMessageLog/unReadMessageCount', params)
}
// 消息列表 POST
export function getMessageLog (params) {
  return POST('/nutrition/portal/nutMessageLog/pageList', params)
}
// 消息详情
export function getMessageDetails (params) {
  return GET('/nutrition/portal/nutMessageLog/messageDetail', params)
}
// 添加评论
export function addNutComment (params) {
  return POST('/nutrition/portal/nutComment/addNutComment', params)
}
// 获取互助圈动态详情
export function getHelpArticleDetail (params) {
  return GET('/nutrition/portal/nutHelpArticle/detail', params)
}
// 查询科普文章/互助圈动态的顶级评论信息（分页）
export function getRemarkTop (params) {
  return POST('/nutrition/portal/nutComment/pageListByPid', params)
}
// 查询评论的全部回复（分页）
export function getRemarkChild (params) {
  return GET('/nutrition/portal/nutComment/pageListChildAndParent', params)
}
// 线上/线下订单列表（分页） POST
export function getOrderList (params) {
  return POST('/nutrition/portal/nutOnlineOrder/orderList', params)
}

// 查询咨询列表（分页）
export function getConsultationList (params) {
  return GET('/nutrition/portal/nutOnlineOrder/consultationList', params)
}
